from fisheye_consts import FISHEYE_ROUTE_UPDATE_PACKET_SIZE
from packet import Packet

class RouteUpdatePacket(Packet):
    """
    The linkstate update packet. This packet is broadcasted over the network from one node to all its neighbors.
    """
    def __init__(self, src_node_id, dst_node_id, topology_map):
        """
        Constructor.
        """
        Packet.__init__(self, src_node_id, dst_node_id, FISHEYE_ROUTE_UPDATE_PACKET_SIZE)
        self._topology_map = topology_map
        
    def get_topology_map(self):
        """
        Returns the topology map (i.e. the link state information) of the originating node.
        """
        return self._topology_map
        
    def __repr__(self):
        return "(RouteUpdatePacket [%s,%s])" % (str(self._src_node_id), str(self._dst_node_id))
